package sword_to_1;

import node.ListNode;

import java.util.ArrayList;
import java.util.List;

public class LeeCode_22 {
    public static void main(String[] args) {

    }
    private static ListNode getKthFromEnd(ListNode head, int k) {
        List<ListNode> list = new ArrayList<>();
        while (head != null){
            list.add(head);
            head = head.next;
        }
        return list.get(list.size() - k);
    }
}
